package com.sphd.emanu.adapter;

import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sphd.emanu.R;
import com.sphd.emanu.pojo.vip.MemPoints;
import com.wzutils.TimeUtils;

import java.util.List;

/**
 * @Author Hu
 * @Time 2017/6/29 --14:19.
 * @Email 87683202@qq.com
 */
public class PointscenterAdapter extends BaseQuickAdapter<MemPoints, BaseViewHolder> {
    private int status;

    public PointscenterAdapter(@LayoutRes int layoutResId, @Nullable List<MemPoints> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MemPoints item) {
        helper
                .setText(R.id.points_name, status == 0 ? (item.getProductName()) : (item.getOrders() != null ? "订单获取" :
                        item.getDeposit() != null ? "充值获取" : "手动录入"))
                .setText(R.id.points,status==0?String.valueOf(item.getDebit()):String.valueOf(item.getCredit()))
                .setText(R.id.points_time, TimeUtils.dateToString(item.getCreateDate(), TimeUtils.YEAR_MONTH_DAY_HOUR_MIN));
    }

    public void setStatus(int status) {
        this.status = status;
    }
}
